#include "Tester.h"
#ifdef __PATHAPITESTER__ON

#include <cstdlib>
#include <string>
#include <Support\PathApi.h>

#ifndef MAX_PATH
#define MAX_PATH	256
#endif

TEST(PATHAPI, fileExist)
{
	EXPECT_FALSE(fileExist(""));

	const char* fileName = "C:\\Projects\\EngineV1.0\\Tester\\PathApiTester.cpp";
	EXPECT_TRUE(fileExist(fileName));
}

TEST(PATHAPI, directoryExist)
{
	EXPECT_FALSE(directoryExist(""));

	const char* directoryName = "C:\\Projects\\EngineV1.0\\Tester";
	EXPECT_TRUE(directoryExist(directoryName));

	const char* directoryName2 = "C:\\Projects\\EngineV1.0\\Tester\\";
	EXPECT_TRUE(directoryExist(directoryName2));
}

TEST(PATHAPI, directoryEmpty)
{
	EXPECT_FALSE(directoryEmpty(""));

	const char* directoryName = "C:\\Projects\\EngineV1.0\\Tester";
	EXPECT_FALSE(directoryEmpty(directoryName));

	const char* directoryName2 = "C:\\Projects\\EngineV1.0\\Tester\\";
	EXPECT_FALSE(directoryEmpty(directoryName2));
}

TEST(PATHAPI, fileNameTest)
{
	char _fileName[MAX_PATH];
	fileName("", _fileName);
	EXPECT_TRUE(strcmp("", _fileName) == 0);

	const char* directoryName = "C:\\Projects\\EngineV1.0\\Tester";
	fileName(directoryName, _fileName);
	EXPECT_TRUE(strncmp("Tester", _fileName, 6) == 0);

	const char* directoryName2 = "C:\\Projects\\EngineV1.0\\Tester\\";
	fileName(directoryName2, _fileName);
	EXPECT_TRUE(strncmp("Tester\\", _fileName, 7) == 0);
	
	const char* directoryName3 = "C:\\Projects\\EngineV1.0\\Tester\\PathApiTester.cpp";
	fileName(directoryName3, _fileName);
	EXPECT_TRUE(strncmp("PathApiTester.cpp", _fileName, 17) == 0);
}
#endif


